<template>
  <div>
    <!-- nav -->
    <van-nav-bar :left-text="Caddress" fixed left-arrow @click-left="$router.push({path: '/address'})"/>
    <!-- home404 -->
    <home404 v-if="$store.state.logging == 0 ? true : false"></home404>
    <!-- shopList -->
    <shopList v-if="$store.state.logging == 1 ? true : false"></shopList>
    <!-- tabbar -->
    <tabbar></tabbar>
  </div>
</template>

<script>
import { apiLng, apiCaddress } from '../../api/currentAddress'
import tabbar from '../tabbar/tabbar'
import home404 from '../home/home404'
import shopList from '../home/shopList'
export default {
  data() {
    return {
      Caddress: ''
    }
  },
  components: {
    tabbar,
    home404,
    shopList
  },
  methods: {
  },
  created() {
    // 定位
    apiCaddress()
    .then(result => {
      this.Caddress = result.data.regionName + result.data.city
    })
    .catch(error => {
      this.Caddress = '未获得地址'
      console.log(error);
    })
  }
}
</script>

<style lang="less" scoped>
  // nav
  .van-nav-bar {
    background: #f44;
  }
  .van-nav-bar__text {
    color: #fff;
    font-weight: 700;
  }
  .van-icon-arrow-left {
    color: #fff;
  }
</style>
